class JobnumbersController < ApplicationController
  before_action :set_jobnumber, only: [:show, :edit, :update, :destroy]

  # GET /jobnumbers
  # GET /jobnumbers.json
  def index
    @jobnumbers = Jobnumber.all
  end

  # GET /jobnumbers/1
  # GET /jobnumbers/1.json
  def show
  end

  # GET /jobnumbers/new
  def new
    @jobnumber = Jobnumber.new
  end

  # GET /jobnumbers/1/edit
  def edit
  end

  # POST /jobnumbers
  # POST /jobnumbers.json
  def create
    @jobnumber = Jobnumber.new(jobnumber_params)

    respond_to do |format|
      if @jobnumber.save
        format.html { redirect_to @jobnumber, notice: 'Jobnumber was successfully created.' }
        format.json { render :show, status: :created, location: @jobnumber }
      else
        format.html { render :new }
        format.json { render json: @jobnumber.errors, status: :unprocessable_entity }
      end
    end
  end

  # PATCH/PUT /jobnumbers/1
  # PATCH/PUT /jobnumbers/1.json
  def update
    respond_to do |format|
      if @jobnumber.update(jobnumber_params)
        format.html { redirect_to @jobnumber, notice: 'Jobnumber was successfully updated.' }
        format.json { render :show, status: :ok, location: @jobnumber }
      else
        format.html { render :edit }
        format.json { render json: @jobnumber.errors, status: :unprocessable_entity }
      end
    end
  end

  # DELETE /jobnumbers/1
  # DELETE /jobnumbers/1.json
  def destroy
    @jobnumber.destroy
    respond_to do |format|
      format.html { redirect_to jobnumbers_url, notice: 'Jobnumber was successfully destroyed.' }
      format.json { head :no_content }
    end
  end

  private
    # Use callbacks to share common setup or constraints between actions.
    def set_jobnumber
      @jobnumber = Jobnumber.find(params[:id])
    end

    # Never trust parameters from the scary internet, only allow the white list through.
    def jobnumber_params
      params.require(:jobnumber).permit(:name)
    end
end
